<?php
/**
 * 公司sku基础颜色模型
 * (model)
 */
namespace App\Models\Product;

use Illuminate\Database\Eloquent\Model;

class ProductSkuColor extends Model{

    protected $table = 'product_sku_color';

    protected $guarded = [];

    const STATUS_YES = 1; //启用
    const STATUS_NO  = 2; //停用
    public static $_status = [
        self::STATUS_YES => '启用',
        self::STATUS_NO  => '停用',
    ];

    public static function options(){

        $re = self::query()->get()->map(function ($model){
            return collect(['color' => $model->color_code.'-'.$model->color_cn,
                'color_code' => $model->color_code]);
        });

        return $re->pluck('color','color_code');
    }

}
